{% load static %}

<link rel="stylesheet" href="{% static 'polls/style.css' %}">
<div class="container">
    <h1>{{ question.question_text }}</h1>

    <div class="results-container">
        <!-- 总票数显示 -->
        <div class="total-votes-display">
            总票数: <span class="total-number">{{ total_votes }}</span>
        </div>

        <!-- 投票结果列表 -->
<ul class="results-list">
    {% for choice_data in choices_data %}
    <li>
        <div class="choice-info">
            <span class="choice-text">{{ choice_data.choice.choice_text }}</span>
            <span class="choice-votes">{{ choice_data.choice.votes }} 票 ({{ choice_data.percentage|floatformat:1 }}%)</span>
        </div>
        <div class="vote-bar-container">
            <div class="vote-bar" style="width: {{ choice_data.percentage }}%; background-color: {{ choice_data.color }};"></div>
        </div>
    </li>
    {% endfor %}
</ul>
    </div>

    <div class="action-buttons">
        <a href="{% url 'polls:detail' question.id %}" class="vote-link">重新投票</a>
        <a href="{% url 'polls:index'%}" class="vote-link">返回投票列表</a>
    </div>
</div>
<footer>
    <div class="footer-content">
        <div class="copyright">
            &copy; 2025 投票系统，保留所有权利。
        </div>
        <div class="footer-links">
            <a href="/">首页</a>
            <a href="/admin">管理后台</a>
            <a href="https://gitee.com/cdg6666/django">关于我们</a>
            <a href="https://gitee.com/cdg6666/django">联系方式</a>
        </div>
    </div>
</footer>